import { request } from "../request";



export interface ListRes {
    /* */
    code: number;

    /* */
    message: string;

    /* */
    data: {
        /* */
        resourceId: number;

        /* */
        chatId: number;

        /* */
        userId: number;

        /* */
        ossUrl: string;

        /* */
        type: string;

        /* */
        createdAt: Record<string, unknown>;

        title: string;
    }[];

    /* */
    timestamp: Record<string, unknown>;
}

/**
 * 获取AI资源列表
 * @param userID 用户ID
 * @returns AI资源列表
 */
export const getAiResourcesListAPI = async (userID: number): Promise<ListRes> => {
    const token = localStorage.getItem("token");
    return request(`/api/ai-resources/list?userID=${userID}`, {
        method: "get",
        headers: {
            "Content-Type": "application/x-www-form-urlencoded",
            Authorization: `Bearer ${token}`
        }
    });
};
